<?php
App::uses('AppModel', 'Model');
/**
 * Livre Model
 *
 * @property Edition $Edition
 * @property Auteur $Auteur
 */
class Livre extends AppModel {

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'titre';
	
	// public $actsAs = array('Containable');
/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'titre' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * hasMany associations
 *
 * @var array
 */
public $hasMany = array(
	'Edition' => array(
		'className' => 'Edition',
		'foreignKey' => 'livre_id'
	),
	'LivresTagsCategory' => array(
		'className' => 'LivresTagsCategory',
		'foreignKey' => 'livre_id'
	)		
);

/**
 * hasAndBelongsToMany associations
 *
 * @var array
 */
public $hasAndBelongsToMany = array(
	'Auteur' => array(
		'className' => 'Auteur',
		'joinTable' => 'auteurs_livres',
		'foreignKey' => 'livre_id',
		'associationForeignKey' => 'auteur_id',
		'unique' => 'keepExisting'
	),
	'TagsCategory' => array(
		'className' => 'TagsCategory',
		'joinTable' => 'livres_tags_categories',
		'foreignKey' => 'livre_id',
		'associationForeignKey' => 'tags_category_id',
		'unique' => 'keepExisting'
	)
);

}
